package com.rn01;

import android.support.annotation.Nullable;
import com.facebook.react.uimanager.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;

/**
 * Created by yankai on 2015/10/29.
 */
public class MTDViewManager extends ViewGroupManager<MTDView> {

	public static final String REACT_CLASS = "RCTMTDView";

	/**
	 * @return the name of this view manager. This will be the name used to reference this view
	 * manager from JavaScript in createReactNativeComponentClass.
	 */
	@Override
	public String getName() {
		return REACT_CLASS;
	}

	/**
	 * Subclasses should return a new View instance of the proper type.
	 *
	 * @param reactContext
	 */
	@Override
	protected MTDView createViewInstance(ThemedReactContext reactContext) {
		return new MTDView(reactContext);
	}

	@ReactProp(name = "alpha")
	public void setAlpha(MTDView view, @Nullable float alpha) {
		view.setAlpha(alpha);
	}

	@ReactProp(name = "orientation")
	public void setOrientation(MTDView view, @Nullable int orientation) {
		view.setOrientation(orientation);
	}

}
